package com.leyou.item.service;

import com.leyou.item.mapper.SpecParamMapper;
import com.leyou.item.pojo.SpecParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author shkstart
 * @create 2020-04-05 13:08
 */

@Service
public class SpecParamService {
    @Autowired
    private SpecParamMapper specParamMapper;

    public List<SpecParam> querySpecParamByGid(Long gid, Long cid, Boolean searching, Boolean generic) {
        SpecParam specParam = new SpecParam();
        specParam.setGroupId(gid);
        specParam.setCid(cid);
        specParam.setSearching(searching);
        specParam.setGeneric(generic);
        List<SpecParam> select = specParamMapper.select(specParam);
        return select;
    }

    public int insertParam(SpecParam specParam) {
        int i = specParamMapper.insertSelective(specParam);
        return i;
    }


    public int updateParam(SpecParam specParam) {
        int i = specParamMapper.updateByPrimaryKeySelective(specParam);
        return i;
    }

    public int deleteByPKId(Long id) {
        return specParamMapper.deleteByPrimaryKey(id);
    }
}
